package com.lz.football.module.rankinglist
{
	import com.common.utils.Reflection;
	import com.liangzhong.model.AppData;
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;

	/**
	 * 国家排名  
	 * @author Administrator
	 * 
	 */
	public class NationRanking extends RankingBaseView
	{
		
		/**
		 *选中的国家 
		 */
		private var _select:MovieClip;
		public function NationRanking()
		{
		}
		override public function initUI(view:Object=null):void
		{
			skin = Reflection.createInstance("com.lz.modul.rankingList.nationrank");
			this.addChild(skin);
			page_num = 10;
			view_type = 2;
			super.initUI();
			//_select = skin.countyr_1;
			for(var i:int = 1;i <= 6;i++)
			{
				skin["coutry_" + i].gotoAndStop(1);
				skin["coutry_" + i].addEventListener(MouseEvent.CLICK,onSelectHanlder);
			}
			selectMc(skin.coutry_1);
		}
		
		protected function onSelectHanlder(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
			var str:String = event.target.name;
			if(_select == skin[str])return;
			selectMc(skin[str]);
		}
		
		private function selectMc(mc:MovieClip):void
		{
			if(mc == null)return;
			if(_select != null)
				_select.gotoAndStop(1);
			_select = mc;
			_select.gotoAndStop(2);
			nationDate();
		}
		override public function addEvtListener():void
		{
			super.addEvtListener();
			
		}
		override public function removeEvtListener():void
		{
			for(var i:int = 1;i <= 6;i++)
			{
				skin["coutry_" + i].removeEventListener(MouseEvent.CLICK,onSelectHanlder);
			}
			super.removeEvtListener();
		}
		override public function destroyView():void
		{
			removeEvtListener();
			super.destroyView();
			
		}
		
		
		public function nationDate():void
		{
			if(_select == null)return;
			var id:int = _select.name.split("_")[1];
			setDate(AppData.getInstance().rankingListDateManager.nationDic[id]);
			
		}
	}
}